Returning User-Defined Errors

The UFError enumerated type provides several errors that are common to many types of functions. If appropriate, have your UFL function return one of these predefined types. If no error occurs, you can return UFNoError.

If your function can cause an error that is not predefined, however, you can establish a user-defined error. You do this by:

A user-defined error string in the error table might look like this:

char *ErrorTable[] =
{
    "My User-defined Error"
};

This error string is assigned an error index by Crystal Reports. The first error is 0, the second is 1, etc. If an error occurs in your function, you assign the appropriate index value to the ReturnValue.UFReturnUserError member of the parameter block. For example:

ParamBlock->ReturnValue.UFReturnUserError = 0;

Once you specify a user-defined error, you can return the UFError value UFUserError from your function. When the Formula Editor finds the error in a formula entered in the Formula text box (when the Check or Accept button is clicked), it will use the error index specified to report the appropriate string listed in the error table.



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com